<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //test对象
        function Test() {
            this.eat = function () {
                console.log("test");
            };

        }

        function Test2() {
            this.eat = function () {
                console.log("test2");
            };
        }

        Test2.prototype.test = function () {
            console.log("test2原型");
        }
        Test.prototype.test = function () {
            console.log("test原型");
        }

        var test = new Test()
        test.test()
        Test.prototype = new Test2();
        // test.__proto__ = new Test2()
        // test.test()

        test = new Test();
        test.test()   
    </script>
</body>

</html>